home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Graphics / include / camera_3d.h < prev    next >
Encoding:
Text File  |  1995-03-25  |  3.0 KB  |  58 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    camera.h
  3. //    Date:                    9/4/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class definition for a camera
  7. //
  8. //------------------------------------------------------------------------------
  9.  
  10. #include "point_3d.h"
  11. #include "matrix_3d.h"
  12.  
  13. #ifndef    CAMERA
  14. #define    CAMERA
  15.  
  16. //------------------------------------------------------------------------------
  17. //    classes
  18. //------------------------------------------------------------------------------
  19. class    camera                                                                                                                                        //    camera class
  20. {                                                                                                                                                                //    begin camera class definition
  21.     private:                                                                                                                                            //    private interface
  22.     protected:                                                                                                                                        //    protected interface
  23.             point_3d    eye;                                                                                                                        //    eye location
  24.             matrix_3d    viewing, inverse;                                                                                                //    the viewing matrix_3d suite
  25.     public:                                                                                                                                                //    public interface
  26.             camera (const point_3d &eye, const point_3d &to, real fov);                                //    default constructor
  27.             void            Look (const point_3d &eye, const point_3d &to, real fov);                //    set the camera location and viewing direction
  28. const matrix_3d    &Transform (void) const;                                                                                //    return a reference to the transformation matrix_3d
  29. const matrix_3d    &Inverse (void) const;                                                                                    //    return a reference to the inverse transformation matrix_3d
  30. const    point_3d    &Eye (void) const;                                                                                            //    return a reference to the eye point_3d
  31. };                                                                                                                                                            //    end camera class definition
  32.  
  33. //------------------------------------------------------------------------------
  34. //    inlines
  35. //------------------------------------------------------------------------------
  36. inline    const matrix_3d    &camera::Transform (void) const                                                    //    return a reference to the transformation matrix_3d
  37. {                                                                                                                                                                //    begin
  38.     return viewing;                                                                                                                                //    return the matrix_3d
  39. }                                                                                                                                                                //    end
  40.  
  41. inline    const matrix_3d    &camera::Inverse (void) const                                                        //    return a reference to the inverse transformation matrix_3d
  42. {                                                                                                                                                                //    begin
  43.     return inverse;                                                                                                                                //    return the matrix_3d
  44. }                                                                                                                                                                //    end
  45.  
  46. inline    const point_3d    &camera::Eye (void) const                                                                //    return a reference to the eye point_3d
  47. {                                                                                                                                                                //    begin
  48.     return eye;                                                                                                                                        //    return the point_3d
  49. }                                                                                                                                                                //    end
  50.  
  51. //------------------------------------------------------------------------------
  52. //    functions
  53. //------------------------------------------------------------------------------
  54. real    LensToFOV (int focal_length = 50, real film_size = 43.26661531);                    //    compute the fov from a film size (measured diagonally) and lens focal length
  55.  
  56. //------------------------------------------------------------------------------
  57.  
  58. #endif    //CAMERA